/*
package com.example.forum.controller;


import com.example.springbootmybatis.commons.annotations.UncheckToken;
import com.example.springbootmybatis.commons.tools.excel.ExcelImpl;
import com.example.springbootmybatis.commons.tools.mailer.MailService;
import com.example.springbootmybatis.entity.TProduct;
import com.example.springbootmybatis.service.IAsyncTaskService;
import com.example.springbootmybatis.service.ITProductService;
import com.example.springbootmybatis.vo.JsonResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;

@RestController
@Api(tags = "测试控制层")
@RequestMapping("/Test")
public class TestController {
    @Autowired
    private MailService mailService;

    @Autowired
    private ExcelImpl excelImpl;


    @Autowired //注入service
    private ITProductService productService;

    @Autowired
    private IAsyncTaskService asyncTaskService;


    @Autowired
    RabbitTemplate rabbitTemplate;  //使用RabbitTemplate,这提供了接收/发送等等方法

    @UncheckToken
    @ApiOperation(value = "发送邮件")
    @RequestMapping(value = "/send", method = {RequestMethod.POST})
    public String send(String email) {
        mailService.sendSimpleTextMailActual("发送主题", "发送内容", new String[]{email}, null, null, null);
        return "1";
    }


    @UncheckToken
    @ApiOperation(value = "发送邮件")
    @RequestMapping(value = "/sendHtml", method = {RequestMethod.POST})
    public String sendHtml(String email, String content) {
        mailService.sendHtmlMail("发送html测试", content, new String[]{email});
        return "1";
    }


    @UncheckToken
    @ApiOperation(value = "导出excel")
    @RequestMapping(value = "/emport", method = {RequestMethod.POST})
    public JsonResult emport() {
        try {
            List<TProduct> list = productService.list();
            excelImpl.export(list);
            return new JsonResult(HttpStatus.OK, "成功", list);
        } catch (Exception e) {
            e.printStackTrace();
            return new JsonResult(HttpStatus.INTERNAL_SERVER_ERROR, "失败", null);
        }
    }

    @UncheckToken
    @ApiOperation(value = "导入excel")
    @RequestMapping(value = "/importExcel", method = { RequestMethod.GET })
    public JsonResult importExcel() {
        try {
            var result = excelImpl.readExcelData("D:\\workbook2.xlsx");
            productService.saveBatch(result);
            return new JsonResult(HttpStatus.OK, "成功", result);
        } catch (Exception e) {
            e.printStackTrace();
            return new JsonResult(HttpStatus.INTERNAL_SERVER_ERROR, "失败", null);
        }
    }

    @UncheckToken
    @ApiOperation(value = "异步多线程")
    @RequestMapping(value = "/TestAsyncTask", method = {RequestMethod.POST})
    public boolean TestAsyncTask() {
        for (int i = 0; i < 20; i++) {
            asyncTaskService.executeAsyncTask1(i);
        }
        return true;
    }

    @ApiOperation(value = "消息队列")
    @UncheckToken
    @RequestMapping(value = "/sendDirectMessage", method = {RequestMethod.POST})
    public String sendDirectMessage(String email) {
        String messageId = String.valueOf(UUID.randomUUID());
        String messageData = "test message, hello!";
        String createTime = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
        Map<String,Object> map=new HashMap<>();
        map.put("messageId",messageId);
        map.put("messageData",email);
        map.put("createTime",createTime);
        //将消息携带绑定键值：TestDirectRouting 发送到交换机TestDirectExchange
        rabbitTemplate.convertAndSend("TestDirectExchange", "TestDirectRouting", map);
        return "ok";
    }


    @ApiOperation(value = "sendTopicMessage1")
    @UncheckToken
    @RequestMapping(value = "/sendTopicMessage1", method = {RequestMethod.POST})
    public String sendTopicMessage1() {
        String messageId = String.valueOf(UUID.randomUUID());
        String messageData = "message: M A N ";
        String createTime = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
        Map<String, Object> manMap = new HashMap<>();
        manMap.put("messageId", messageId);
        manMap.put("messageData", messageData);
        manMap.put("createTime", createTime);
        rabbitTemplate.convertAndSend("topicExchange", "topic.man", manMap);
        return "ok";
    }

    @ApiOperation(value = "sendTopicMessage2")
    @UncheckToken
    @RequestMapping(value = "/sendTopicMessage2", method = {RequestMethod.POST})
    public String sendTopicMessage2() {
        String messageId = String.valueOf(UUID.randomUUID());
        String messageData = "message: woman is all ";
        String createTime = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
        Map<String, Object> womanMap = new HashMap<>();
        womanMap.put("messageId", messageId);
        womanMap.put("messageData", messageData);
        womanMap.put("createTime", createTime);
        rabbitTemplate.convertAndSend("topicExchange", "topic.woman", womanMap);
        return "ok";
    }





}
*/
